#ifndef __QpwDecorationObject__
#define __QpwDecorationObject__

#include <QtCore/QUuid>
#include <QtGui/QPolygonF>
#include <QpwGeometryDatabase.h>
#include <QpwStyleDatabase.h>
#include <QpwSubType.h>

class QpwSubType;

namespace QpwWorld {

class DecorationObject {
public:
    enum ObjectTypes {
        DecorationObjectType = 1,
        StaticObjectType,
        QuasiStaticObjectType,
        DynamicObjectType
    };
    explicit DecorationObject( const QpwSubType & subType = QpwSubType(),
        const QpwStyleDatabase & styleDatabase = QpwStyleDatabase(),
        const QpwGeometryDatabase & geometryDatabase = QpwGeometryDatabase() );
    virtual ~DecorationObject();

    virtual ObjectTypes baseType() const { return DecorationObjectType; }
    QpwSubType subType() const { return p_subType; }
    QpwStyle style() const { return p_style; }
    QString name() const { return p_name; }
    QString description() const { return p_description; }
    quint32 health() const { return p_health; }
    QpwWorld::Geometry geometry() const { return p_geometry; }
    quint32 eventProcessorType() const { return p_eventProcessorType; }
    quint32 destroyProcessorType() const { return p_destroyProcessorType; }
    quint32 revision() const { return p_revision; }
    virtual bool isValid() const;
    QUuid uuid() const { return p_uuid; }

    void setStyle( const QpwStyle & style ) { p_style = style; modified(); }
    void setName( const QString & name ) { p_name = name; modified(); }
    void setDescription( const QString & description ) { p_description = description; modified(); }
    void setHealth( quint32 health ) { p_health = health; modified(); }
    void setGeometry( const QpwWorld::Geometry & geometry ) { p_geometry = geometry; modified(); }
    void setUuid( const QUuid & uuid ) { p_uuid = uuid; modified(); }

    static QString typeName( quint32 type );

protected:
    void modified() { internal_modified(); }

private:
    virtual bool insertObjectInWorld() { return true; }
    inline void internal_modified() { ++p_revision; }

    quint32 p_revision;
    QpwSubType p_subType;
    QpwStyle p_style;
    QString p_name,
            p_description;
    quint32 p_health;
    Geometry p_geometry;
    quint32 p_eventProcessorType,
            p_destroyProcessorType;
    QUuid p_uuid;

};

};

#endif//__QpwDecorationObject__
